function fKick(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				if args[2] then
					v:Kick(args[2])
				else
					v:Kick("no reason")
				end
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fKickPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fBan(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local Time
		if args[2] != "perma" and args[2] then 
			Time = tonumber(args[2])
		else
			Time = 0
		end
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				if args[2] then
					v:Ban(Time,"")
					v:Kick("Kicked and Banned")
				else
					v:Ban(Time,"no reason")
				end
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fBanPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fBanTm(commandName,args)
    return {commandName..args[1].."10",commandName..args[1].."720",commandName..args[1].."1440",commandName..args[1].."2880",commandName..args[1].."perma"}
end

function fGod(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:GodEnable()
				printAction(ply:Nick().." granted god to "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fGodPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fUngod(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:GodDisable()
				printAction(ply:Nick().." revoked god from "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fUngodPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fIgnite(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:Ignite(99999,0)
				printAction(ply:Nick().." ignited "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fIgnitePl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fUnignite(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:Extinguish()
				printAction(ply:Nick().." extinguished "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fUnignitePl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fCloak(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:SetColor(0,0,0,0)
				printAction(ply:Nick().." cloaked "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fCloakPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fUncloak(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:SetColor(255,255,255,255)
				printAction(ply:Nick().." uncloaked "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fUncloakPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fKill(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:Kill()
				printAction(ply:Nick().." annihilated "..v:Nick())
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fKillPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end

function fSilentkill(ply,command,args)
	if ply:IsAdmin() then
		local argument = args[1]
		local Pla = {}
		local ents = ents.FindByClass("player")
		for _, ent in pairs(ents) do
			if string.find(ent:GetName(),argument) != nil then 
				table.insert(Pla,ent)
			end
		end
		if table.Count(Pla) >= 1 then
			for k, v in pairs(Pla) do
				v:KillSilent()
			end
		else
			ply:ChatPrint("No player named ".. args[1])
		end
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fSKPl(commandName,args)
	local PlayerName = {}
	for k, v in pairs(player.GetAll()) do
		table.insert(PlayerName,commandName.." \""..v:Nick().."\"")
	end
	return PlayerName
end
function fMaxPr(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxprops",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxBa(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxballoons",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxBu(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxbuttons",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxDy(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxdynamite",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxEf(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxeffects",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxEm(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxemitters",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxHo(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxhoverballs",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxLa(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxlamps",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxLi(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxlights",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxNP(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxnpcs",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxRa(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxragdolls",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxSp(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxspawners",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxTh(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxthrusters",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxTu(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxturrets",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxVe(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxvehicles",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fMaxWh(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_maxwheels",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fAllTalk(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sv_alltalk",args[1])
		printAction("sv_alltalk changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fNoClip(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_noclip",args[1])
		printAction("sbox_noclip changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fFallDmg(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("mp_falldamage",args[1])
		printAction("mp_falldamage changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fPlplDmg(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_plpldamage",args[1])
		printAction("sbox_plpldamage changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fGodMode(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sbox_godmode",args[1])
		printAction("sbox_godmode changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fHostChng(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("hostname",args[1])
		printAction("Hostname changed to "..args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fTimeSc(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("phys_timescale",args[1])
		printAction("phys_timescale changed to "..tostring(args[1]))
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fGrav(ply,command,args)
	if ply:IsAdmin() then
		RunConsoleCommand("sv_gravity",args[1])
	else
		ply:ChatPrint("You're not an admin!")
	end
end

function fCleanUpAll(ply,command,args)
	ply:ChatPrint("hehe... doesn't work yet")
end


///////////////////                          Client Menu
concommand.Add("mm_kick", fKick, fKickPl)
concommand.Add("mm_ban", fBan, fBanPl, fBanTm)
concommand.Add("mm_god", fGod, fGodPl)
concommand.Add("mm_ungod", fUngod, fUngodPl)
concommand.Add("mm_ignite", fIgnite, fIgnitePl)
concommand.Add("mm_unignite", fUnignite, fUnignitePl)
concommand.Add("mm_cloak", fCloak, fCloakPl)
concommand.Add("mm_uncloak", fUncloak, fUncloakPl)
concommand.Add("mm_kill", fKill, fKillPl)
concommand.Add("mm_silentkill", fSilentkill, fSKPl)

///////////////////                          Limits/admin Menu
concommand.Add("sbox_mm_MaxPr", fMaxPr)
concommand.Add("sbox_mm_MaxBa", fMaxBa)
concommand.Add("sbox_mm_MaxBu", fMaxBu)
concommand.Add("sbox_mm_MaxDy", fMaxDy)
concommand.Add("sbox_mm_MaxEf", fMaxEf)
concommand.Add("sbox_mm_MaxEm", fMaxEm)
concommand.Add("sbox_mm_MaxHo", fMaxHo)
concommand.Add("sbox_mm_MaxLa", fMaxLa)
concommand.Add("sbox_mm_MaxLi", fMaxLi)
concommand.Add("sbox_mm_MaxNP", fMaxNP)
concommand.Add("sbox_mm_MaxRa", fMaxRa)
concommand.Add("sbox_mm_MaxSp", fMaxSp)
concommand.Add("sbox_mm_MaxTh", fMaxTh)
concommand.Add("sbox_mm_MaxTu", fMaxTu)
concommand.Add("sbox_mm_MaxVe", fMaxVe)
concommand.Add("sbox_mm_MaxWh", fMaxWh)
concommand.Add("sbox_mm_alltalk", fAllTalk)
concommand.Add("sbox_mm_noclip", fNoClip)
concommand.Add("sbox_mm_falldmg", fFallDmg)
concommand.Add("sbox_mm_plpldmg", fPlplDmg)
concommand.Add("sbox_mm_godmode", fGodMode)
concommand.Add("sbox_mm_hostname", fHostChng)
concommand.Add("sbox_mm_timescale", fTimeSc)
concommand.Add("sbox_mm_gravity", fGrav)

///////////////////                          PropProtection Menu
concommand.Add("mm_pp_cleanup", fCleanUpAll)